--[[
错误码与描述

]]

local M = class("ErrorCode")

function M:ctor( ... )
	self:init()
end

function M:regisger( ... )
	g.log:info("ErrorCode regisger!")
	self:init()
end

function M:init()
	self.ok                                          	= 0      --成功回应
	self.fail                                           = 1      --失败
	self.remot_call_fail                                = 2      --远程调用失败
	self.sys_error                                    	= 3      --系统错误
	self.invalid_fd										= 4  --无效的fd
	self.input_err                                      = 5  --参数错误
	self.verify_err                                 	= 6  --账号验证失败
	self.regist_err                               		= 7  --注册失败
	self.invalid_rid = 8 --无效rid
	self.invalid_mid = 9 --无效mid
	self.invalid_room_cfg = 10 --无效配置
	self.invalid_room_min_buy = 11 --金币不足房间买入
	self.invalid_room_max_limit = 12 --金币超过房间最大限制
	self.room_match_err = 13 --房间匹配失败
	self.seat_err = 14 --已经是坐下的状态
	self.desk_user_err = 15 --玩家不在这个桌子里
	self.not_enough_err = 16 --金币不足
	self.seat_down_err = 17 --没有位置可坐
	self.not_match_time = 18 --比赛时间没到
	self.offsite_login = 19 --异地登录
	self.offline = 20 --玩家不在线
	self.room_create_err = 21 --房间创建失败
	self.too_conn = 22 --每秒连接数过多
	self.too_msg = 23 --发送消息过快
	self.no_heart = 24 --无心跳影响
	self.no_power_in = 25 --无权限进入此房间
	self.game_over = 26 --游戏已经结束
	self.not_in_match = 27 --你没有在比赛
	self.in_too_tables = 28 --同时进入太多桌子
	self.invalid_sid = 29 --请坐下
	self.invalid_ip = 30 --ip被封
	self.unpack_err = 31 --解包错误

	--错误描述
	self.des_ch =  {
		[self.fail] = "请求失败",
		[self.remot_call_fail] = "远程调用失败",
		[self.sys_error] = "系统错误",
		[self.invalid_fd] = "无效的fd",
		[self.input_err] = "参数错误",
		[self.verify_err] = "账号验证失败",
		[self.invalid_rid] = "无效rid",
		[self.invalid_mid] = "无效mid",
		[self.invalid_room_cfg] = "无效配置",
		[self.invalid_room_min_buy] = "金币不足房间买入",
		[self.invalid_room_max_limit] = "金币超过房间最大限制",
		[self.room_match_err] = "房间匹配失败",
		[self.seat_err] = "已经是坐下的状态",
		[self.desk_user_err] = "玩家不在这个桌子里",
		[self.not_enough_err] = "金币不足",
		[self.seat_down_err] = "没有位置可坐",
		[self.not_match_time] = "比赛时间没到",
		[self.offsite_login] = "账号异地登录",
		[self.offline] = "玩家不在线",
		[self.room_create_err] = "房间创建失败",
		[self.too_conn] = "每秒连接数过多",
		[self.too_msg] = "发送消息过快",
		[self.no_heart] = "无心跳影响",
		[self.no_power_in] = "无权限进入此房间",
		[self.game_over] = "游戏已经结束",
		[self.not_in_match] = "你没有在比赛",
		[self.in_too_tables] = "同时进入太多桌子",--
		[self.invalid_sid] = "请先坐下",--
		[self.invalid_ip] = "ip被封",--
		[self.unpack_err] = "解包错误",--


	}

	self.des_en =  {
		[self.fail] = "req failed",
		[self.remot_call_fail] = "remot call failed",
		[self.sys_error] = "system err",
		[self.invalid_fd] = "invalid fd",
		[self.input_err] = "input err",
		[self.verify_err] = "verify err",
		[self.invalid_rid] = "invalid rid",
		[self.invalid_mid] = "invalid mid",
		[self.invalid_room_cfg] = "invalid room config",
		[self.invalid_room_min_buy] = "small then min chip",
		[self.invalid_room_max_limit] = "big then max chip",
		[self.room_match_err] = "room match err",
		[self.seat_err] = "seat err",
		[self.desk_user_err] = "user not in table",
		[self.not_enough_err] = "not enough chip",
		[self.seat_down_err] = "sit down err",
		[self.not_match_time] = "wait match time",
		[self.offsite_login] = "login other way",
		[self.offline] = "user offline",
		[self.room_create_err] = "room create err",
		[self.too_conn] = "too many connection",
		[self.too_msg] = "send message too fast",
		[self.no_heart] = "no heart",
		[self.no_power_in] = "no power to in this room",
		[self.game_over] = "game is over",
		[self.not_in_match] = "you not in match",
		[self.in_too_tables] = "in too more tables",--
		[self.invalid_sid] = "please seat down",--
		[self.invalid_ip] = "ip is ban",
		[self.unpack_err] = "unpack_err",
	}
end

--错误描述
function M:getDes(code)
	return self.des_en[code] or ""
end




return M
